package com.example.dengxiao.test;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.widget.Button;
import android.view.View;


public class ONE extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_one);
        Button button1 = (Button)findViewById(R.id.button1); //找到在main.xml中创建的Button
        button1.setOnClickListener(button_listener);
    }
    private Button.OnClickListener button_listener = new Button.OnClickListener(){     //创建button listener
        public void onClick(View v){

            Intent intent = new Intent();
            intent.setClass(ONE.this,TWO.class);// TestActivity 是要跳转到的Activity，需要在src下手动建立TestActivity.java文件
            startActivity(intent);
            setTitle("other Activity!");
        }
    };
}
